<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="/WEB-INF/tlds/c.tld"%>
<%@ taglib prefix="spring" uri="/WEB-INF/tlds/spring.tld"%>
<c:set var="BasePath" value="${pageContext.request.contextPath}"></c:set>
<c:set var="Plugins" value="${pageContext.request.contextPath}/res/plugins"></c:set>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>商品查询列表页面</title>

<link href="${Plugins}/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/jquery/jquery-1.3.2.min.js"	type="text/javascript"></script>
<link href="${Plugins}/ligerUI/skins/ligerui-icons.css" rel="stylesheet" type="text/css" />
<script src="${Plugins}/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script type="text/javascript" src="${BasePath}/res/js/ligerCommon.js"></script>

<style type="text/css">
#searchbar{
   margin-bottom: 10px;
   margin-left:15px;
  }
  .navbar {
		height: 20px;
		border-bottom: #E6E6E6 solid 1px;
		line-height: 20px;
	}
.l-button-search {
	width: 50px;
	margin-left: 10px;
	padding-bottom: 2px;
	display: inline;
}
</style>
</head>

<body style="padding:6px; overflow:hidden;">
<div class="navbar">
		<span>您当前的位置：</span>
		采购管理 &gt; 请购单管理  &gt;新增采购单 
</div>

<form id="form1" name="form1" action="getCommodityList.do" method="post" >
<div id="searchbar">
<%-- 货品编号：<input type="text" id="prodNo" name="prodNo" value="${productVo.prodNo}">
商品名称：<input type="text" id="commoName" name="commoName" value="${productVo.commoName}" />&nbsp; --%>
        <!--  <input type="submit" id="btnSearch" value="查询" class="l-button-search" />
           <input type="button" id="btnReset" value="重置" class="l-button-search" />
</div> -->
</form>
<div id="maingrid" style="margin:0; padding:0"></div>
<script>
	var grid = null;
	/* $(function() {
		$("#btnSearch").click(function() {
			var sel = $("#prodNo").val()+$("#commoName").val();
			if(window.parent.sel != sel){
				window.parent.list = new Array();
			}
			window.parent.sel = sel;
			$("#form1").submit();
		});
	}); */

    var basePath='${BasePath}';
    
    $(function () {
    	 // 重置
        $("#btnReset").click(function(){
    		$('#searchbar :input').not(':submit, :button, :reset').val('').removeAttr('checked').removeAttr('selected');
    	});
    	
        grid = $("#maingrid").ligerGrid({
            columns: [
			{ display: '', render:function(rowdata, rowindex, value){
				var h="";
				h+="<input type='hidden' value='"+rowdata.supName+"' id='nam"+rowindex+"'/>";
				h += "<input type='radio' value='"+rowdata.code+"' id='rad"+rowindex+"'  name='myradio' onclick='getValue("+rowindex+")'  /> ";
				return h;
			}},          
            //{ display: '供应商code', name: 'code'},
            { display: '供应商名称', name: 'supName'},
            { display: '供应商简称', name: 'supShortName'},
            //{ display: '供应商编码', name: 'supCode'},
            { display: '经营类别', name: 'operateTpye'},
            { display: '合同结束日期', name: 'contractDayEnd'},
            ], 
            pageSize:30,
            width: '100%',
            height: '100%',
            dataType: 'server', 
            dataAction: 'server',
            pagesizeParmName: 'pageSize',
            parms: [
                    /* {name: "prodNo", value:$("#prodNo").val()},
                    {name: "commoName", value:$("#commoName").val()} */
            	],
            url: "getAjaxSupplierInfoList.do"
        });
    });
    
 /*    var isChecked = true;
    function updateData(checked, data){
    	isChecked = true;
    	if(checked){
    		var list = new Array();
    		list = window.parent.commoditylist;
    		var tx = "";
    		for ( var i = 0; i < list.length; i++) {
				if(list[i].supCode == data.supCode){
					tx = data.prodNo+"供应商已添加！";
				};
			};
			if(tx != ""){
				$.ligerDialog.warn(data.supCode+"供应商已添加！");
				isChecked = false;
				return false;	
			}
    		window.parent.list.push(data);
    	}else{
    		var list = new Array();
    		list = window.parent.list;
    		for ( var i = 0; i < list.length; i++) {
    			if(list[i].prodNo == data.prodNo){
    				window.parent.list.splice(i,1);
    			};
			}
    	};
    }; */
    
    /* var isOut = true;
    function valProd(){
    	isChecked = true;
    	if(window.parent.list.length == 0){
    		var atl = grid.getSelectedRows().length > 0 ? "这些商品已选择，请重新选择商品" : "请选择商品";
			$.ligerDialog.warn(atl);
			isOut = false;
		}
    } */
    
    function getValue(da){
    	window.parent.scode=$("#rad"+da).val();
     	window.parent.sname=$("#nam"+da).val();
     	window.parent.actprice=grid.getData()[da].taxCostPrice; 	
     }
</script>
</body>
</html>